package cn.tedu.oop;

/**
 * @program: HolidayHomework
 * @description:
 * @author: Zane Zhang
 * @create: 2022-06-05
 **/
//1.定义学生类
public class Student {
    //2.定义学生类的属性
    int sno;//学号
    String name;//姓名
    char gender;//性别
    Major major;//专业
    double totalScore;//总成绩

    //3.提供本类的全参构造,注意分数需要调用Major类的getScore()获取
    public Student(int sno, String name, char gender, Major major, double totalScore) {
        this.sno = sno;
        this.name = name;
        this.gender = gender;
        this.major = major;
        this.totalScore = major.getScore();
    }

    //4.重写toString()方法,方便直接查看学生类的所有属性值
    @Override
    public String toString() {
        return "学号:" + sno +
                ", 姓名:'" + name + '\'' +
                ", 性别:" + gender +
                ", 专业:" + major +
                ", 总成绩:" + totalScore;
    }
}

